package com.dzsw.e2p.util;


import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;

import java.io.File;
import java.io.IOException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@Configuration
public class PoiPdfFontMap {

    private Map<String, File> fontMap;

    public PoiPdfFontMap() throws IOException {
        fontMap = new ConcurrentHashMap<>();
        fontMap.put("ＭＳ Ｐゴシック", new File(new ClassPathResource("fonts/MS-PGothic.ttf").getURI()));
        fontMap.put("ＭＳ ゴシック", new File(new ClassPathResource("fonts/MS-Gothic.ttf").getURI()));
    }

    public File getFont(String fontName) {
        return fontMap.get(fontName);
    }
}
